﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace JarvisProject1
{
    public class VariableGridView : GridView
    {
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            var MessageItem = item as ObjectMessage;
            var RubricItem = item as Rubrika_Object;
            if (MessageItem != null)
            {
                element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty,MessageItem.HorizontalSize); 
                element.SetValue(VariableSizedWrapGrid.RowSpanProperty,MessageItem.VerticalSize);
            }
            if (RubricItem != null)
            {
                element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, RubricItem.HorizontalSize);
                element.SetValue(VariableSizedWrapGrid.RowSpanProperty, RubricItem.VerticalSize);
            }
            base.PrepareContainerForItemOverride(element, item);
        }
    }
}
